package com.hotel.service.impl;  
  
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.hotel.dao.mapper.UserMapper;
import com.hotel.entity.User;
import com.hotel.entity.UserExample;
import com.hotel.service.LoginService;
import com.hotel.utils.Message;



@Service("loginService")  
public class LoginServiceImpl implements LoginService {  
	
	@Resource  
    private UserMapper userMapper;
	
	public String Verification(User user) {
		UserExample example = new UserExample();
		UserExample.Criteria criteria = example.createCriteria();
		criteria.andAccountEqualTo(user.getAccount());
		List<User> i = userMapper.selectByExample(example);
		
		if(i.isEmpty()){
			return Message.Message_3000;
		}
		else if(user.getAccount().equals(i.get(0).getAccount()) && user.getPassword().equals(i.get(0).getPassword())){
			return Message.Message_2000;
		}
		
		return Message.Message_3001;
	}
 
}